package com.zxq.ruoyi.network.tcp.handler;


import com.zxq.frame.core.EFrame;
import com.zxq.ruoyi.network.tcp.handler.dispatch.TCPDispatchHandler;
import com.zxq.ruoyi.network.tcp.handler.impl.*;

public class TCPDispatchHandlerFactory {




    /**
     * 根据tcp类型，生成对应的handler
     * @param eFrame tcp类型
     * @return
     */
    public static TCPDispatchHandler create(EFrame eFrame) {
        TCPDispatchHandler dispatchHandler = null;
        switch (eFrame) {
            case sf_register:
                dispatchHandler = new SFRegistrationHandler();
                break;
            case iec_104:
                dispatchHandler = new IEC104DispatchHandler();
                break;
            case modbus:
                dispatchHandler = new TCPModbusPoxyHandler();
                break;
            case dlt645:
                dispatchHandler = new DLT645TCPDispatchHandler();
                break;
            case jt808:
                dispatchHandler = new JT808DispatchHandler();
                break;
        }
        return dispatchHandler;
    }


}
